package com.xpc.mapper;

import com.xpc.pojo.qin.StudentsSimpleInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Qinkuer
 * @version 1.0.0
 * @ProjectName UniversityGradeAdministrationSystem
 * @ClassName StudentsSimpleInfoMapper.java
 * @Description 职位管理功能特供
 * @createTime 2022年05月25日 00:24:00
 */
@Mapper
public interface StudentsSimpleInfoMapper {


    /**
        * @description 职位管理处,获取某个班级里学生简单的信息
     * 1.学生id
     * 2.学号
     * 3.学生姓名
     * 4.学生职位
     * 5.所在专业
     * 6.宿舍号
     * 7.手机号
        * @param classid 班级编号
        * @return  java.util.List<com.xpc.pojo.qin.StudentsSimpleInfo>
        * @author Qinkuer
        * @Date  2022/5/25
        */
    @Select("select mcc.user_id as userId, mcc.committee_id as committeeId ,mcc.position_id as positionId,mcc.dorm as dormitoryNo,mcc.majorName as major, mcc.posistionName as `position`,mcc.name,a.account_id as accountId from \n" +
            "\t(select mcc.*,u.name from\n" +
            "\t\t(select mcc.*,p.name as posistionName from\n" +
            "\t\t\t(select mcc.*,m.name as majorName from \n" +
            "\t\t\t\t(select mcc.id as committee_id,mcc.class_id,mcc.position_id ,mcc.user_id ,s.major_id ,s.dorm ,s.phone  from \n" +
            "\t\t\t\t\t(select * from member_committee_class mcc where mcc.class_id = #{classid}) as mcc\n" +
            "\t\t\t\tleft join student s on mcc.user_id=s.user_id ) as mcc \n" +
            "\t\t\tleft join major m on mcc.major_id =m.id ) as mcc \n" +
            "\t\tleft join `position` p on mcc.position_id = p.id) as mcc \n" +
            "\tleft join `user` u on mcc.user_id=u.user_id ) as mcc \n" +
            "left join account a on mcc.user_id=a.user_id")
    List<StudentsSimpleInfo> getListByClassID(@Param("classid")String classid);
//    select mcc.user_id as userId, mcc.committee_id as committeeId ,mcc.position_id as positionId,mcc.dorm as dormitoryNo,mcc.majorName as major, mcc.posistionName as `position`,mcc.name,a.account_id as accountId from
//            (select mcc.*,u.name from
//		(select mcc.*,p.name as posistionName from
//                     (select mcc.*,m.name as majorName from
//                     (select mcc.id as committee_id,mcc.class_id,mcc.position_id ,mcc.user_id ,s.major_id ,s.dorm ,s.phone  from
//					(select * from member_committee_class mcc where mcc.class_id = 1) as mcc
//    left join student s on mcc.user_id=s.user_id ) as mcc
//    left join major m on mcc.major_id =m.id ) as mcc
//    left join `position` p on mcc.position_id = p.id) as mcc
//    left join `user` u on mcc.user_id=u.user_id ) as mcc
//    left join account a on mcc.user_id=a.user_id
}
